﻿using System.Collections;
using System.Collections.Generic;

namespace LogikBug.ModularMvc.Locations
{
	public abstract class Location : ILocation
	{
		#region Methods

		public abstract IEnumerator<string> GetEnumerator();

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		#endregion
	}

	public abstract class Location<T> : Location, ILocation<T>
	{
		#region Fields

		private IEnumerable<T> _list;

		#endregion

		#region Properties

		public virtual IEnumerable<T> List
		{
			get
			{
				if (_list == null)
				{
					_list = Linq.Empty<T>();
				}

				return _list;
			}
			protected set
			{
				_list = value ?? Linq.Empty<T>();
			}
		}

		#endregion

		#region Methods

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		#endregion
	}
}
